<template>
  <a-card :bordered="false">
    <a-tabs :activeKey="activeKey" @change="handleChange">
      <a-tab-pane key="1" tab="应聘信息">
        <ErpHrApplyRegisterBillListDetail :applyId="query.applyId"></ErpHrApplyRegisterBillListDetail>
      </a-tab-pane>
      <a-tab-pane key="2" tab="入职申请信息">
        <ErpHrInductionBillListDetail :applyId="query.applyId"></ErpHrInductionBillListDetail>
      </a-tab-pane>
      <a-tab-pane key="3" tab="员工档案信息">
        <ErpEmployeeFileListDetail :employeeId="query.id"></ErpEmployeeFileListDetail>
      </a-tab-pane>
      <a-tab-pane key="4" tab="合同信息">
        <ErpHrEmployeeContractList :employeeId="query.id"></ErpHrEmployeeContractList>
      </a-tab-pane>
      <a-tab-pane key="5" tab="转正信息">
        <ErpHrEmployeeRegularBillListDetail :employeeId="query.id"></ErpHrEmployeeRegularBillListDetail>
      </a-tab-pane>
      <!-- <a-tab-pane key="6" tab="调岗调薪信息">
        <ErpHrPostSalaryAdjustmentList :employeeId="query.id"></ErpHrPostSalaryAdjustmentList>
      </a-tab-pane> -->
      <a-tab-pane key="6" tab="调岗信息">
        <ErpHrEmployeeAdjustPostBillList :employeeId="query.id"></ErpHrEmployeeAdjustPostBillList>
      </a-tab-pane>
      <a-tab-pane key="7" tab="离职信息">
        <ErpHrEmployeeResignBillListDetail :employeeId="query.id"></ErpHrEmployeeResignBillListDetail>
      </a-tab-pane>
      <a-tab-pane key="8" tab="薪酬信息">
        <ErpHrSalaryListDetail :employeeId="query.id"></ErpHrSalaryListDetail>
        <!-- <ErpPayrollLedgerListDetail :employeeId="query.id"></ErpPayrollLedgerListDetail> -->
      </a-tab-pane>
    </a-tabs>
  </a-card>
</template>
<script>
import ErpHrApplyRegisterBillListDetail from './modules/ErpHrApplyRegisterBillListDetail.vue'
import ErpHrPostSalaryAdjustmentList from './modules/ErpHrPostSalaryAdjustmentList.vue'
import ErpHrEmployeeContractList from './modules/ErpHrEmployeeContractList.vue'
import ErpHrInductionBillListDetail from './modules/ErpHrInductionBillListDetail.vue'
import ErpHrEmployeeRegularBillListDetail from './modules/ErpHrEmployeeRegularBillListDetail.vue'
import ErpHrEmployeeAdjustPostBillList from './modules/ErpHrEmployeeAdjustPostBillList.vue'
import ErpHrEmployeeResignBillListDetail from './modules/ErpHrEmployeeResignBillListDetail.vue'
import ErpEmployeeFileListDetail from './modules/ErpEmployeeFileListDetail.vue'
import ErpPayrollLedgerListDetail from './modules/ErpPayrollLedgerListDetail.vue'
import ErpHrSalaryListDetail from './modules/ErpHrSalaryListDetail.vue'
import Vue from 'vue'
import { USER_INFO } from "@/store/mutation-types"

export default {
  name: 'schedule',
  props: ['empId','applyId'],
  data() {
    return {
      activeKey: '3',
      query: {
        id: '',
        applyId: ''
      }
    }
  },
  components: { 
    ErpHrApplyRegisterBillListDetail,
    ErpHrPostSalaryAdjustmentList,
    ErpHrEmployeeContractList,
    ErpHrInductionBillListDetail,
    ErpHrEmployeeRegularBillListDetail,
    ErpHrEmployeeResignBillListDetail,
    ErpEmployeeFileListDetail,
    ErpPayrollLedgerListDetail,
    ErpHrSalaryListDetail,
    ErpHrEmployeeAdjustPostBillList
  },
  created(){
    const userInfo = Vue.ls.get(USER_INFO)
    if(this.empId==undefined){
      this.query.id = userInfo.employee.id
     }
     if(this.applyId==undefined){
      this.query.applyId = userInfo.employee.applyId
     }
    if(Object.keys(this.$route.query).length === 0){
      this.query.id = userInfo.employee.id
      this.query.applyId = userInfo.employee.applyId 
     } else if(this.$route.query.id){
      this.query = this.$route.query
     } else if(this.$route.query.key){
      this.activeKey=this.$route.query.key
     }
     console.log("empId",this.empId);
     console.log("applyId",this.applyId);
     if(this.empId){
      this.query.id = this.empId;
     }
     if(this.applyId){
      this.query.applyId = this.applyId;
     }
     
  },
  mounted() {
      console.log('mounted');
  },
  watch:{
    empId: {
      handler (value) {
        console.log("empId",value);
        if (value) {
          console.log("empId",value);
          this.query.id= value;
        }
      },
      immediate: true
    },
    applyId: {
      handler (value) {
        console.log("applyId",value);
        if (value) {
          console.log("applyId",value);
          this.query.applyId= value;
        }
      },
      immediate: true
    },
  },
  methods: {
    handleChange(e){
      this.activeKey = e
    }
  },
  destroyed() {
    console.log("destroyed",111);
    // 清除缓存、移除事件监听等操作
  }
}
</script>
<style scoped lang="scss">

</style>
